#include<iostream>
#include<vector>
using namespace std;
class Solution {
public:
    int findRepeatDocument(vector<int>& documents) {
        int n = documents.size();
        vector<int>hash(n);
        for (int i = 0; i < n; i++) {
            hash[documents[i]]++;
            if (hash[documents[i]] >= 2)return documents[i];
        }
        return 0;
    }
};